<?php
namespace app\index\controller;

use sreeb\Curl;
use think\Response;

class Index
{
    public function index()
    {



        header("Content-type: text/html; charset=GBK");
        $curl = Curl::getInstance();
        $res = $curl
            ->setProxy('39.137.69.7','8080','','')
            ->setHeader([
                'Accept'=>'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
                'Accept-Language'=>'zh-CN,zh;q=0.9',
                'User-Agent'=>'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36',
            ])
            ->get('http://whois.pconline.com.cn/ipJson.jsp')
            ->send();
        echo '<b>响应数据:</b><br>' .  $res->getBody();
        return response()->header('Content-type','text/html; charset=GBK');


//        echo '<pre>';
//        echo '<b>请求header:</b><br>' .  $res->getInfo('request_header');
//        echo '<b>响应header:</b><br>' .  $res->getHeader();
//        echo '<b>响应数据:</b><br>' .  iconv('GBK','UTF-8',$res->getBody());


    }
}
